package com.example.project.mapper;

import com.example.project.entity.Course;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

public interface CourseMapper {

    @Update("INSERT INTO t_course(id,course_id,teacher_name,capacity,start_time,end_time) VALUES(#{id},#{course_id},#{teacher_name},#{capacity},#{start_time},#{end_time})")
    @Transactional //增加
    void save(Course course);

    @Select("SELECT * FROM t_course WHERE course_id=#{course_id}")
    Course findById(@Param("course_id") String course_id); //根据id查找

    @Delete("DELETE FROM t_course WHERE course_id=#{course_id}")
    void deleteById(String course_id);
}
